<!DOCTYPE html>
<html>
	<head>
		<meta charset="UTF-8">
		<title></title>
		<link rel="stylesheet" href="css/lib/bootstrap.min.css"/>
		<script src="js/lib/jquery-1.11.0.js"></script>
		<script src="js/lib/bootstrap.min.js"></script>
		<script src="js/lib/vue.min.js"></script>
		<script src="js/lib/vue-resource.js"></script>
		<script src="js/base.js" type="text/javascript" charset="utf-8"></script>
	</head>
	 <style>
	 	body{
			font-size:12px;
		}
	 	table,
		th,
		td {
			border: 1px solid grey;
			border-collapse: collapse;
			padding: 5px;
			vertical-align: middle !important;
		}
		
		table td:nth-child(odd) {
			background-color: #f1f1f1;/*#e2e9ea*/
			
		}
		table td:nth-child(even) {
			
		}
		table tr:nth-child(even) {
			background-color:#ffffff;
		}
		input{
			width:280px;
		}
		span{
			width:20px;color:red;display:inline-block;text-align:center;
		}
		#sho{
			width:300px;
			height:50px;
			background:#d9534f;
			opacity:0.8;
			border-radius:8px;
			color:#fff;
			text-align: center;
			font-size:30px;
			position: absolute;
			top:0px;
			left:550px;
			display:none;
		}
	 </style>
	<body>
		<div class="" id="box">
			<div id="sho"></div>

		<!--按照品牌名查询品牌信息-->
			<div style="padding:15px 5px 0px 5px;border:3px solid #ccc;margin-bottom:15px">
			<table class="table table-hover">				
				<tbody>
					<tr>
						<th colspan="8">赚道钱包品牌信息：</th>
					</tr>
					<tr class="text-center">
						<td>品牌名称</td>
						<td>品牌编号</td>
						<td>管理编号</td>
						<td>自动升级状态</td>
						<td>自动升级人数</td>						
						<td>创建时间</td>
						<td>操作</td>
					</tr>
					<tr id="show" class="text-center">
						<td id="show1"></td>
						<td id="show2"></td>
						<td id="show3"></td>
						<td id="show4"></td>
						<td id="show5"></td>						
						<td id="show7"></td>
						<td><button id="btn" v-on:click="add(msg)">变更</button></td>
					</tr>
					<tr>
						<td colspan="8" id="show01" class="text-center" style="display:none;">							
						</td>
					</tr>
				</tbody>
			</table>		
		</div>
		</div>
	</body>
	<script>
		$(function(){
					/*自定义过滤器*/
		Vue.filter("todo",function(value){
			if(value == 0){
				return value = "消费者"
			}
			if(value == 1){
				return value = "分销商"
			}
			if(value == 2){
				return value = "代理商"
			}
			if(value == 3){
				return value = "服务商"
			}
		})
		
		new Vue({
				el:"#box",
				data: {
					list:[],
					token:"",
					pages:"",
					page:"",
					msg:{}
				},
				created:function(){
					/*var p5 = $('#p5').val();*/
						var p5 = 1;
						$.ajax({
							url:window.baseUrl+"user/brand/query/id",
							type:"GET",
							dataType:"json",
							data:{
								brand_id:p5
							},
							success:function(data){
								console.log("接口调用成功！")
								console.log(data)
								console.log(data.result)						
								var msg = data.result
								if(data.result == null){
									$('#show').hide()
									$("#show01").show().html("暂无数据。。")	
								}else{
									$('#show01').hide()
									$('#show').show()
									this.list = data.result
									$('#show1').html(msg.name)
									$('#show2').html(msg.number)
									$('#show3').html(msg.manageid)
									
									if(msg.autoUpgrade == 0){
										$('#show4').html("未启用")
									}
									if(msg.autoUpgrade == 1){
										$('#show4').html("启用")
									}
									$('#show5').html(msg.autoUpgradePeople)
									$('#show6').html(msg.shareMainAddress)
									$('#show7').html(msg.createTime)
								}			
							},
							error:function(data){
								console.log("接口调用失败！")
							}
						})
				},
				methods:{

					add:function(){
                        $.ajax({
                            url:window.baseUrl+"user/auto/upgrade/add",
                            type:"GET",
                            dataType:"json",
                            data:{
                                brand_id:p5
                            },
                            success:function(data){
                                console.log("接口调用成功！")
                                console.log(data)
                                console.log(data.result)
                                var msg = data.result
                                if(data.result == null){
                                    $('#show').hide()
                                    $("#show01").show().html("暂无数据。。")
                                }else{
                                    $('#show01').hide()
                                    $('#show').show()
                                    this.list = data.result
                                    $('#show1').html(msg.name)
                                    $('#show2').html(msg.number)
                                    $('#show3').html(msg.manageid)

                                    if(msg.autoUpgrade == 0){
                                        $('#show4').html("未启用")
                                    }
                                    if(msg.autoUpgrade == 1){
                                        $('#show4').html("启用")
                                    }
                                    $('#show5').html(msg.autoUpgradePeople)
                                    $('#show6').html(msg.shareMainAddress)
                                    $('#show7').html(msg.createTime)
                                }
                            },
                            error:function(data){
                                console.log("接口调用失败！")
                            }
                        })
					}
						
			   		
				}
			})
		})
	</script>
</html>
